# -*- coding: UTF-8 -*-

from luma.core.interface.serial import i2c
from luma.core.render import canvas
from luma.oled.device import ssd1306, ssd1325, ssd1331, sh1106
from time import sleep

'''
serial = i2c(port='/dev/i2c-2', address=0x3C)
device = ssd1306(serial, rotate=0)

# Box and text rendered in portrait mode
with canvas(device) as draw:
    draw.rectangle(device.bounding_box, outline="white", fill="black")
    draw.text((10, 20), "xhbone", fill="white")
sleep(10)
'''
class oled():
    def __init__(self) -> None:
        #i2c地址
        self.serial=i2c(port='/dev/i2c-2', address=0x3C)
        #rotate：0不旋转
        #      ：1旋转90
        self.device = ssd1306(serial, rotate=0)

    def show(self,string,axis=(int,int)):
        with canvas(self.device) as draw:
            draw.text(axis, string, fill="white")







        










    